package Offer;

import java.util.Stack;

public class Test21 
{
    Stack<Integer> stack1=new Stack<Integer>();
    Stack<Integer> stack2=new Stack<Integer>();
	public static void main(String[] args) 
	{
		
	}
    public void push(int value)
    {
        stack1.push(value);
        if(stack2.isEmpty()||value<stack2.peek())
        {
        	stack2.push(value);
        }
        else
        {
        	stack2.push(stack2.peek());
        }
        
    }
    
    public void pop() 
    {
        if(!stack1.isEmpty()&&!stack2.isEmpty())
        {
        	stack1.pop();
        	stack2.pop();
        }
    }
    
    public int top() 
    {
        return stack1.peek();
    }
    
    public int min() 
    {
        return stack2.peek();
    }
}
